package testSudoku;

import static org.junit.Assert.*;
import sudoku.*;
import junit.framework.TestCase;
import org.junit.Before;
import org.junit.Test;
//testing the first question in easy level
public class testEasyQ2 {

		private Manager Man;
		/**
		 * Sets up the test fixture.
		 * Called before every test case method.
		 */
		@Before
		public void setUp() { Man = new Manager(1,1); }
		/**
		 * Tears down the test fixture.
		 * Called after every test case method.
		 */
		public void tearDown() {}
		
		
		// Test case 1: x coordinate can't less than 0
		@Test
		public void testXnotLess0() {
			boolean result;
			int x = -1;
			int y = 1;
			String input = "1";
			char i = 1;
			result = Man.validate_input(x , y ,input, i,0);
			assertEquals(result, false);
		}
		
		// Test case 2: x coordinate can't larger than 8
		@Test
		public void testXnotLarger8() {
			boolean result;
			int x = 9;
			int y = 1;
			String input = "1";
			char i = 1;
			result = Man.validate_input(x , y ,input, i,0);
			assertEquals(result, false);
		}
		
		// Test case 3: y coordinate can't less than 0
		@Test
		public void testYnotLess0() {
			boolean result;
			int x = -1;
			int y = 1;
			String input = "1";
			char i = 1;
			result = Man.validate_input(x , y ,input, i,0);
			assertEquals(result, false);
		}
		// Test case 4: y coordinate can't larger than 8
		@Test
		public void testYnotLarger8() {
			boolean result;
			int x = 9;
			int y = 1;
			String input = "1";
			char i = 1;
			result = Man.validate_input(x , y ,input, i,0);
			assertEquals(result, false);
		}
		
		// Test case 5: number n can't less than 1
		@Test
		public void testNnotLess1() {
			boolean result;
			int x = 1;
			int y = 1;
			String input = "0";
			char i = 0;
			result = Man.validate_input(x , y ,input, i,0);
			assertEquals(result, false);
		}
		
		// Test case 6: number n can't larger than 9
		@Test
		public void testNnotLarger9() {
			boolean result;
			int x = 1;
			int y = 1;
			String input = "10";
			char i = 10;
			result = Man.validate_input(x , y ,input, i,0);
			assertEquals(result, false);
		}
		
		// Test case 7: not Duplicate N in the 3*3 block
		@Test
		public void testNnotDuplicate() {
			boolean result;
			int x = 0;
			int y = 1;
			String input = "2";
			char i = '2';
			result = Man.validate_input(x , y ,input, i,0);
			assertEquals(result, false);
		}
		
		// Test case 8: not number can overwrite default number
		@Test
		public void testNnotOverwrite() {
			boolean result;
			int x = 2;
			int y = 3;
			String input = "1";
			char i = '1';
			result = Man.validate_input(x , y ,input, i,0);
			assertEquals(result, false);
		}
		
		
		// Test case 9: number can add in empty position
		@Test
		public void testempty() {
			boolean result;
			int x = 2;
			int y = 0;
			String input = "4";
			char i = '4';
			result = Man.validate_input(x , y ,input, i,0);
			assertEquals(result, true);
		}
		
		
		
		// Test case 10: not Duplicate N in row
		@Test
		public void testNnotDuplicateRow() {
			boolean result;
			int x = 0;
			int y = 1;
			String input = "5";
			char i = '5';
			result = Man.validate_input(x , y ,input, i,0);
			assertEquals(result, false);
		}

		// Test case 11: not Duplicate N in column
		@Test
		public void testNnotDuplicateColumn1() {
			boolean result;
			int x = 2;
			int y = 0;
			String input = "6";
			char i = '6';
			result = Man.validate_input(x , y ,input, i,0);
			assertEquals(result, false);
		}

		
		
		
}